﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Data;
using System.Data.SqlClient;
using Maticsoft.DBUtility;

public partial class ReportG : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnViewReport_Click(object sender, EventArgs e)
    {
        try
        {
            string StartTime = tbStartTime.Text;
            string EndTime = tbEndTime.Text;

            if (string.IsNullOrEmpty(StartTime))
            {
                StartTime = "200001";
            }

            if (string.IsNullOrEmpty(EndTime))
            {
                EndTime = "209912";
            }

            this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
            LocalReport localReport = ReportViewer1.LocalReport;
            localReport.ReportPath = "Reports/Emp1/ReportG.rdlc";
            localReport.DataSources.Clear();

            // 所属指挥中心
            DataSet ds1 = new DataSet();
            SqlParameter[] para1 = {new SqlParameter("@StartTime",StartTime)
                                 ,new SqlParameter("@EndTime",EndTime)
                                  };
            ds1 = DbHelperSQL.ExecProc("uspEmp1ReportG1", para1);
            ReportDataSource rds1 = new ReportDataSource();
            rds1.Name = "DataSet1";
            rds1.Value = ds1.Tables[0];
            localReport.DataSources.Add(rds1);

            //导师姓名
            DataSet ds2 = new DataSet();
            SqlParameter[] para2 = {new SqlParameter("@StartTime",StartTime)
                                 ,new SqlParameter("@EndTime",EndTime)
                                  };
            ds2 = DbHelperSQL.ExecProc("uspEmp1ReportG2", para2);
            ReportDataSource rds2 = new ReportDataSource();
            rds2.Name = "DataSet2";
            rds2.Value = ds2.Tables[0];
            localReport.DataSources.Add(rds2);
             
            ReportViewer1.LocalReport.Refresh();

        }
        catch (Exception ex)
        {

            throw;
        }
    }
}